import express from 'express';
const app = express();

app.all("*",(req,res,next)=>{
    res.header("Access-Control-Allow-Origin","*");
    res.header("Access-Control-Allow-Headers","Content-Type,Content-Length, Authorization, Accept,X-Requested-With");
    res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
    res.header("X-Powered-By",' 3.2.1')
    res.header("Content-Type","application/json;charset=utf-8");
    next();
})
const article={
    title:'心肝脾肺肾的阴阳',
    content:'心为阳中之阳，肺为阳中之阴，肝为阴中之阳，肾是阴中之阴，脾至阴。心、肺、脾、肾是人体四大脏腑，其阴阳互为平衡，相互依存，相互'
}
const medicines=[
    {
        name:'龙齿',
        category:"性凉",
        effect:'安神，调节睡眠质量'
    },{
        name:'茯神木',
        category:"性平",
        effect:'安神，调节睡眠深度，抑制惊醒'
    },{
        name:'琥珀',
        category:"性平",
        effect:'安神，调节睡眠质量，抑制多梦'
    }
]
app.get('/article',(req,res)=>{
    res.json(article);
})
app.get('/list',(req,res)=>{
    res.json(medicines);
})
app.listen(8080,()=>{
    console.log('server is running at http://localhost:8080');
})